package com.admission.model;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Cascade;

import com.admission.listener.AuditableEntity;

@Entity
@Table(name = "major")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Major extends AuditableEntity {
	private String name;// 名称
	private String introduce;// 介绍
	private Academy academy;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Lob
	@Basic(fetch = FetchType.LAZY)
	public String getIntroduce() {
		return introduce;
	}

	public void setIntroduce(String introduce) {
		this.introduce = introduce;
	}

	@ManyToOne(cascade = { CascadeType.ALL },optional=true)
	@JoinColumn(name = "academy_id")
	public Academy getAcademy() {
		return academy;
	}

	public void setAcademy(Academy academy) {
		this.academy = academy;
	}

}
